<template>
  <div class="box">
    <div class="card" @click="$router.push(`/schoolDetails/${Number(props.items.school_id)}`)">
      <div class="cover">
        <img :src="props.items.school_cover" alt="" />
      </div>
      <div class="info">
        <div class="title">
          <span>{{props.items.school_name}}</span>  <!-- 驾校名字 -->
          <div class="vip">
            <i class="iconfont icon-vip5"></i>
          </div>
        </div>
        <div class="evaluate">
          <van-rate
            v-model="props.items.school_score"
            :size="12"
            color="#FF842E"
            void-icon="star"
            void-color="#eee"
            allow-half
            readonly
          />
          <span>{{props.items.school_score}}</span>
        </div>
        <div class="about">
          <div>
            <span>2180元起</span>
            <span>{{props.items.licensetype}}班</span> 
          </div>
          <span>{{props.items.schooldistrict}} {{(props.items.distance).toFixed(1)}} km</span> 
        </div>
        <div class="tag">
          <span class="tag2" v-for="(item,i) in labelArray" :key="i">{{ item }}</span>

        </div>
        <div class="event">
          <div><i>券</i> <span>0.9元抵200.00元</span></div>
          <div><i>课</i> <span>0.9元体验课</span></div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { reactive,onMounted } from "vue";
const props = defineProps({
  items: {
    school_cover: String, //驾校图片
    school_name: String,
    licensetype: String, //驾考 班型
    school_score: Number, //驾校评分
    schooldistrict: String, //驾校所在市区
    schoollabel: String, //驾校标签
    school_id: Number, //驾校id
    school_lng: Number, //经度
    school_lat: Number, //纬度
    distance:Number,//距离KM
  },
});
/* 驾校标签  字符串转为数组 */
let labelArray=reactive([])


labelArray=(props.items.schoollabel).split('/')
onMounted(()=>{
  console.log('231231231231233123',props.items);
})









//console.log(111, props.items);
</script>

<style scoped lang="scss">
.box {
  background-color: #fff;
  padding: 0 2px;
}
.card {
  padding: 15px 0;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
}
.card > .cover {
  width: 28%;
}
.card > .cover > img {
  width: 100%;
  height: 50%;
  object-fit: cover;
  border-radius: 8px;
}
.card > .info {
  width: 70%;
}
.card > .info > .title {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
.card > .info > .title > span {
  font-size: 24px;
  font-weight: bold;
  margin-right: 8px;
}
.card > .info > .title > .vip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 3px;
  background-color: #42bafc;
}
.card > .info > .title > .vip > i {
  font-size: 26px;
  color: #fff;
  text-shadow: 0.5px 0.5px rgba(0, 0, 0, 0.5);
}
.card > .info > .evaluate {
  margin-bottom: 8px;
  font-size: 12px;
}
.card > .info > .evaluate > span:nth-child(2) {
  margin-left: 5px;
  color: #ff842e;
}
.card > .info > .evaluate > span:nth-child(3) {
  margin-left: 10px;
}
.card > .info > .about {
  font-size: 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}
.card > .info > .about > div > span {
  margin-right: 15px;
  &:nth-child(2){
    margin-right: 0;
  }
}
.card > .info > .tag {
  margin-bottom: 8px;
  font-size: 12px;
}
.card > .info > .tag > span {
  display: inline-block;
  margin-bottom: 5px;
  padding: 3px 4px 4px;
  border-radius: 2px;
  margin-right: 8px;
}
.card > .info .tag1 {
  background-color: #ffefdf;
  color: #735928;
}
.card > .info .tag2 {
  background-color: #e5f6ff;
  color: #1b9fdd;
}
.card > .info > .event > div:nth-child(1) {
  margin-bottom: 8px;
}
.card > .info > .event i {
  padding: 0 3px 1px;
  font-size: 12px;
  border-radius: 3px;
  margin-right: 3px;
  color: #fff;
}
.card > .info > .event > div:nth-child(1) > i {
  background-color: #fe4a44;
}
.card > .info > .event > div:nth-child(2) > i {
  background-color: #02d0c3;
}
.card > .info > .event span {
  font-size: 14px;
}
</style>
